define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {

        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'withdraw_log_list/index' + location.search,
                    add_url: 'withdraw_log_list/add',
                    edit_url: 'withdraw_log_list/edit',
                    del_url: 'withdraw_log_list/del',
                    multi_url: 'withdraw_log_list/multi',
                    import_url: 'withdraw_log_list/import',
                    table: 'withdraw_log_list',
                }
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'weigh',
                columns: [
                    [
                        {checkbox: true},
                        {field: 'id', title: __('Id')},
                        {field: 'user.username', title: __('用户名'), operate: 'LIKE'},
                        {field: 'today_wit', title: __('今日提现次数'), operate: 'LIKE'},
                        {field: 'today_money', title: __('今日提现金额'), operate: 'LIKE'},
                        {field: 'today_service', title: __('今日提现手续费'), operate: 'LIKE'},
                        {field: 'five_wit', title: __('近五日提现次数'), operate: 'LIKE'},
                        {field: 'five_money', title: __('近五日提现金额'), operate: 'LIKE'},
                        {field: 'five_service', title: __('近五日提现手续费'), operate: 'LIKE'},
                        {field: 'all_wit', title: __('提现总次数'), operate: 'LIKE'},
                        {field: 'all_money', title: __('总提现金额'), operate: 'LIKE'},
                        {field: 'all_service', title: __('总提现手续费'), operate: 'LIKE'},
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },


        add: function () {
            Controller.api.bindevent();
        },
        edit: function () {
            Controller.api.bindevent();
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };

    return Controller;
});